package com.sankuai.xxlrpc.controller;

import com.example.demo.api.DemoService;
import com.xuxueli.xxlrpc.remoting.invoker.annotation.XxlRpcReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    private static final Logger logger = LoggerFactory.getLogger(IndexController.class);

    @XxlRpcReference
    private DemoService demoService;


    @RequestMapping("")
    @ResponseBody
    public String http(String name) {
        try {
            String te = demoService.ceshi("测试值");
            logger.info("第二个接口值：{}", te);
            return te;
        } catch (Exception e) {
            return "error";
        }
    }

}
